<?php namespace  Home\Controller;

use \Hdphp\Controller\Controller;

class PayController extends Controller{
	
	public function index(){
		//清空购物车
		unset($_SESSION['cart']);
		//实例化模型 
		$orderModel = new \Common\Model\Orders;
		//接收订单页面跳转带的oid
		$oid = Q('get.oid',0,'intval');
		//根据oid查询订单的号码
		$ordernumber = $orderModel->where("oid={$oid}")->pluck('ordernumber');
		//根据oid查询订单的总价
		$totalprice = $orderModel->where("oid={$oid}")->pluck("totalprice");
		//根据oid查询订单的支付方式
		$paytype = $orderModel->where("oid={$oid}")->pluck("paytype");
		//根据oid查询订单的送货时间
		$deliverytime = $orderModel->where("oid={$oid}")->pluck("deliverytime");
		//分配数据到页面上
		View::with('paytype',$paytype);
		View::with('deliverytime',$deliverytime);
		View::with('ordernumber',$ordernumber);
		View::with('totalprice',$totalprice);
		View::make();
	}
	
	public function add(){
		$orderModel = new \Common\Model\Orders;
		//调用模型的addData方法  添加数据
		$oid = $orderModel->addData();
		//把方法return的oid值返回 订单页面跳转到支付页面就可以把oid带过来
		$this->ajax($oid);
	}
}



 ?>